//
//  LoginMangager.m
//  JZMCFM
//
//  Created by Mc on 15/11/9.
//  Copyright (c) 2015年 陈卓. All rights reserved.
//

#import "LoginMangager.h"

@implementation LoginMangager

+ (instancetype)sharedInstance
{
    static LoginMangager *manager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        if (manager == nil) {
            manager = [[LoginMangager alloc] init];
        }
    });
    return manager;
}

- (void)loginSuccessHandle
{
    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"login"];
    // 立刻同步
    [[NSUserDefaults standardUserDefaults] synchronize];
    [self getLoginState];
}
- (void)loginOutHandle
{
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"login"];
    // 立刻写入沙盒(立刻同步)
    [[NSUserDefaults standardUserDefaults] synchronize];
    [self getLoginState];
}
- (void)getLoginState
{
    BOOL islogin = [[NSUserDefaults standardUserDefaults] boolForKey:@"login"];
    self.isLogin = islogin;
}

@end
